home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 2: Applications / Linux Cubed Series 2 - Applications.iso / editors / emacs / xemacs / xemacs-1.004 / xemacs-1 / xemacs-19.13 / src / syswait.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-08-04  |  3.4 KB  |  128 lines

  1. /* Define wait system call interface for Emacs.
  2.    Copyright (C) 1993 Free Software Foundation, Inc.
  3.    Copyright (C) 1995 Sun Microsystems.
  4.  
  5. This file is part of XEmacs.
  6.  
  7. XEmacs is free software; you can redistribute it and/or modify it
  8. under the terms of the GNU General Public License as published by the
  9. Free Software Foundation; either version 2, or (at your option) any
  10. later version.
  11.  
  12. XEmacs is distributed in the hope that it will be useful, but WITHOUT
  13. ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  14. FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  15. for more details.
  16.  
  17. You should have received a copy of the GNU General Public License
  18. along with XEmacs; see the file COPYING.  If not, write to the Free
  19. Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  20.  
  21. /* Synched up with: FSF 19.28. */
  22.  
  23. /* Cleaned up by Ben Wing. */
  24.  
  25. /* Define the structure that the wait system call stores.
  26.    On many systems, there is a structure defined for this.
  27.    But on vanilla-ish USG systems there is not.
  28.  
  29.    NOTE: POSIX specifies that int, rather than union wait,
  30.    be used.  BSD systems based on BSD 4.3+ or newer generally
  31.    have int, but those based on BSD 4.3 or older have union wait.
  32.  */
  33.  
  34. #ifndef VMS
  35.  
  36. #  ifdef HAVE_SYS_WAIT_H
  37. #    include <sys/wait.h>
  38. #  endif
  39.  
  40. #  if !defined (HAVE_UNION_WAIT) /* the POSIX / SYSV way */
  41.  
  42. #    define WAITTYPE int
  43. #    ifndef WIFSTOPPED
  44. #      define WIFSTOPPED(w) (((w) & 0377) == 0177)
  45. #    endif
  46. #    ifndef WIFSIGNALED
  47. #      define WIFSIGNALED(w) (((w) & 0377) != 0177 && ((w) & ~0377) == 0)
  48. #    endif
  49. #    ifndef WIFEXITED
  50. #      define WIFEXITED(w) (((w) & 0377) == 0)
  51. #    endif
  52. #    ifndef WRETCODE
  53. #      ifdef WEXITSTATUS
  54. #        define WRETCODE(w) WEXITSTATUS (w)
  55. #      else
  56. #        define WRETCODE(w) ((w) >> 8)
  57. #      endif
  58. #    endif
  59. #    ifndef WSTOPSIG
  60. #      define WSTOPSIG(w) ((w) >> 8)
  61. #    endif
  62. #    ifndef WTERMSIG
  63. #      define WTERMSIG(w) ((w) & 0377)
  64. #    endif
  65. #    ifndef WCOREDUMP
  66. #      define WCOREDUMP(w) (((w) & 0200) != 0)
  67. #    endif
  68.  
  69. #  else /* the older BSD way */
  70.  
  71. #    define WAITTYPE union wait
  72.  
  73. #    ifndef WRETCODE
  74. #      ifdef WEXITSTATUS
  75. #        define WRETCODE(w) WEXITSTATUS(w)
  76. #      else
  77. #        define WRETCODE(w) w.w_retcode
  78. #      endif
  79. #    endif
  80.  
  81. #    undef WCOREDUMP        /* Later BSDs define this name differently.  */
  82. #    define WCOREDUMP(w) w.w_coredump
  83.  
  84. #    if defined (HPUX) || defined (convex)
  85. /* HPUX version 7 has broken definitions of these.  */
  86. /* pvogel@convex.com says the convex does too.  */
  87. #      undef WTERMSIG
  88. #      undef WSTOPSIG
  89. #      undef WIFSTOPPED
  90. #      undef WIFSIGNALED
  91. #      undef WIFEXITED
  92. #    endif /* HPUX | convex */
  93.  
  94. #    ifndef WTERMSIG
  95. #      define WTERMSIG(w) w.w_termsig
  96. #    endif
  97. #    ifndef WSTOPSIG
  98. #      define WSTOPSIG(w) w.w_stopsig
  99. #    endif
  100. #    ifndef WIFSTOPPED
  101. #      define WIFSTOPPED(w) (WTERMSIG (w) == 0177)
  102. #    endif
  103. #    ifndef WIFSIGNALED
  104. #      define WIFSIGNALED(w) (WTERMSIG (w) != 0177 && (WSTOPSIG (w)) == 0)
  105. #    endif
  106. #    ifndef WIFEXITED
  107. #      define WIFEXITED(w) (WTERMSIG (w) == 0)
  108. #    endif
  109.  
  110. #  endif /* HAVE_UNION_WAIT */
  111.  
  112. #else /* VMS */
  113.  
  114. #  define WAITTYPE int
  115. #  define WIFSTOPPED(w) 0
  116. #  define WIFSIGNALED(w) 0
  117. #  define WIFEXITED(w) ((w) != -1)
  118. #  define WRETCODE(w) (w)
  119. #  define WSTOPSIG(w) (w)
  120. #  define WCOREDUMP(w) 0
  121. #  define WTERMSIG(w) (w)
  122. #  include <ssdef.h>
  123. #  include <iodef.h>
  124. #  include <clidef.h>
  125. #  include "vmsproc.h"
  126.  
  127. #endif /* VMS */
  128.